import server from './http.js' //导入axios
// 登录模块
const getLogin=(msg)=>{
    let data=server.post('/login',msg)
    return data
}
//左侧导航
const menusList =  () => {
    let data =  server.get('/menus')
    return data
}

// 用户模块
//用户列表
const userlist =  (params) => {
    // let data =  server.get('/users', {params:params})
    let data =  server.get('/users', {params})
    return data
}

const delUser = (id) => {
    let data = server.delete("users/" + id)
    return data
}

const editUsers = (id, params) => {
    let data = server.put("users/" + id, params)
    return data
}

const changeStatus = (id, type) => {
    let data = server.put(`users/${id}/state/${type}`)
    return data
}


const addUsers = (params) => {
    let data = server.post("users", params)
    return data
}

const getRoles = () => {
    let data = server.get("roles")
    return data
}

export {
    getLogin,menusList,userlist,delUser,editUsers,changeStatus,addUsers,getRoles
}


//接口要命名规范,-获取数据getLogin,设置提交数据 setLogin,
//删除数据 delLogin,列表数据 loginList等